<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">借条用户审批</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>
                        <p:columnToggler datasource="userDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"
                                         rendered="#{receiptSystemUserApproveBean.isNormal()}"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         actionListener="#{receiptSystemUserApproveBean.onReset}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{receiptSystemUserApproveBean.isNormal()}"/>

                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">
                                <p:outputLabel for="name" value="姓名"/>
                                <p:inputText id="name" value="#{receiptSystemUserApproveBean.$.name}"/>

                                <p:outputLabel for="account" value="用户名"/>
                                <p:inputText id="account" value="#{receiptSystemUserApproveBean.$.account}"/>

                                <p:outputLabel for="email" value="邮箱"/>
                                <p:inputText id="email" value="#{receiptSystemUserApproveBean.$.email}"/>

                                <p:outputLabel for="phone" value="联系电话"/>
                                <p:inputText id="phone" value="#{receiptSystemUserApproveBean.$.phone}"/>

                                <p:outputLabel for="weChat" value="微信"/>
                                <p:inputText id="weChat" value="#{receiptSystemUserApproveBean.$.weChat}"/>

                                <p:outputLabel for="organization" value="所属机构"/>
                                <p:inputText id="organization"
                                             value="#{receiptSystemUserApproveBean.$.organization}"/>
                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="userDataTable"
                                         style="width: 100%"
                                         var="user"
                                         value="#{receiptSystemUserApproveBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="97%"
                                         reflow="true"
                                         selection="#{receiptSystemUserApproveBean.selectedRecords}"
                                         resizableColumns="true">

                                <p:column headerText="操作">
                                    <p:splitButton icon="fa fa-eye"
                                                   action="#{receiptSystemUserApproveBean.onEdit(user.id)}"
                                                   process="@this">
                                        <f:setPropertyActionListener value="/views/receipt/user/approve/list.xhtml"
                                                                     target="#{currentUserBean.back}"/>
                                    </p:splitButton>
                                </p:column>

                                <p:column headerText="姓名">
                                    <h:outputText value="#{user.name}"/>
                                </p:column>
                                <p:column headerText="账号">
                                    <h:outputText value="#{user.account}"/>
                                </p:column>
                                <p:column headerText="邮箱">
                                    <h:outputText value="#{user.email}"/>
                                </p:column>
                                <p:column headerText="微信">
                                    <h:outputText value="#{user.weChat}"/>
                                </p:column>
                                <p:column headerText="联系电话">
                                    <h:outputText value="#{user.phone}"/>
                                </p:column>
                                <p:column headerText="所属机构">
                                    <h:outputText value="#{user.organization}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
